import { createApp } from 'vue';
import { createPinia } from 'pinia';
import App from './App.vue';
import { router } from './router';
import vuetify from './plugins/vuetify';
import '@/scss/style.scss';
import PerfectScrollbar from 'vue3-perfect-scrollbar';
import VueApexCharts from 'vue3-apexcharts';
import VueTablerIcons from 'vue-tabler-icons';
import { fakeBackend } from '@/utils/helpers/fake-backend';
import 'vue3-carousel/dist/carousel.css';
//Mock Api data
import './_mockApis';
// import VueDragscroll from "vue-dragscroll";

import Maska from 'maska';

// console.log('=== 应用初始化开始 ===');       


import 'vue3-easy-data-table/dist/style.css';
//i18
import { createI18n } from 'vue-i18n';
import messages from '@/utils/locales/messages';

//ScrollTop
import VueScrollTo from 'vue-scrollto';

//LightBox
import VueEasyLightbox from 'vue-easy-lightbox';
import permsPlugin from '@/utils/perms';
import dictPlugin from '@/plugins/dict';
import messagePlugin from '@/plugins/message';
import confirmPlugin from '@/plugins/confirm';
import channelPlugin from '@/plugins/channel';

const i18n = createI18n({
    locale: 'en',
    messages: messages,
    silentTranslationWarn: true,
    silentFallbackWarn: true
});

const app = createApp(App);
// console.log('Vue应用创建完成');

fakeBackend();
// console.log('Mock后端初始化完成');

app.use(router);
// console.log('路由插件注册完成');

app.use(PerfectScrollbar);
// app.use(VueDragscroll);
const pinia = createPinia();
app.use(pinia);
// console.log('Pinia状态管理注册完成');

app.use(VueTablerIcons);
app.use(i18n);
app.use(Maska);
app.use(VueApexCharts);
app.use(permsPlugin);
app.use(dictPlugin);
app.use(messagePlugin);
app.use(confirmPlugin);
app.use(channelPlugin);
// console.log('所有插件注册完成');

app.use(vuetify).mount('#app');
// console.log('应用挂载完成');

//ScrollTop Use
// app.use(VueScrollTo);
app.use(VueScrollTo, {
    duration: 1000,
    easing: "ease"
});

//Lightbox
app.use(VueEasyLightbox)

